﻿<?xml version="1.0" encoding="utf-8" ?>
<DataScripter XmlInterpreter="DataScripter.XmlInterpreter.XmlEngineConfiguratorv4, DataScripter.XmlInterpreter">

  <Import Path="WellKnownTypes.xml" />

  <InputSource Name="Database" Type="SqlServer" >
    <ConnectionString>Data Source=.;Initial Catalog=TD;Integrated Security=True</ConnectionString>
    <DataProducer Name="dp" Type="DataScripter.Scripting.Query.SqlServer.DataProducer, DataScripter" />
    <Db Name="Db" Type="DataScripter.Database.SqlServer.SqlServerDb, DataScripter" />
    <DatabaseStructure Name="ds" Type="DataScripter.Database.SqlServer.SqlServerDatabaseStructure, DataScripter" />
  </InputSource>

  <Output Name="File" Type="File">
    <Path>OutputScript.SQL</Path>
    <OutputProducer Name="op" Type="DataScripter.Scripting.Output.Sql.SqlServer.SqlServer2008.InsertOutputProducer, DataScripter" />
  </Output>

  <ScriptDefinition Name="Script voor Burt" >
    <!-- Where can also be specified as an attribute-->
    <Table Name="TermAccountActor">
      <Where Clause="ActorID IN (select ActorID from Actor where CustomerNumber=274042)" />
      <Lookup Name="ActorID" LookupTable="Actor" LookupField="CustomerNumber"/>

      <Table Name="TermAccount" >
        <Table Name="Account" >
          <Or>
            <FilterByForeignKey Name="TermAccount_CapitalAccount_FK" />
            <FilterByForeignKey Name="TermAccount_InterestAccount_FK" />
          </Or>
        </Table>
        <Table Name="TermInvestment" />
      </Table>

      <Table Name="TermAccountActorHistory" JoinOn="TermAccountActorID" />

    </Table>
  </ScriptDefinition>

  <MorphActions Name="Morph voor Burt">
    <Table Name="*">
      <Copy Fields="*" />
      <NewId Name="Id"/>
    </Table>
  </MorphActions>

  <Processes>

    <Process Name="LoadData" Service="ReadToDataSetProcess" >
      <InputSource Name="Database" />
      <ScriptDefinition Name="Script voor Burt"/>
      <Sorter Name="TableStructureSorterFirstWithoutIncomingForeignKeys"/>
    </Process>

    <Process Name="Morph" Input="LoadData" Service="MorphProcess" >
      <Actions Name="Morph voor Burt" />
    </Process>

    <Process Name="WriteData" Input="Morph" Service="WriteDataSetToXmlProcess" >
      <FileName Name=".\Test.xml" />
    </Process>

  </Processes>
</DataScripter>
